#include "str.h"


int stringcmp(const char *s1, const char *s2)
{
  while (*s1 == *s2)
  {
	  if(*s1 == '\0')
		  return(0);

	  s1++;
	  s2++;
  }

  return(*s1 - *s2);

 }
 
 int strcasecmp(const char *s1, const char *s2)
 {
	while (toUpper(*s1) == toUpper(*s2))
	{
	  if(*s1 == '\0')
		  return(0);

	  s1++;
	  s2++;
	}

	return(toUpper(*s1) - toUpper(*s2));
 }

int toUpper(int c)
{
	int ret = c;
	
	if( c >= 'a' && c <= 'z')
		ret = c - ('a' - 'A');
	
	return ret;
}


